<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AngelScript: Memory functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="aslogo_small.png"/></td>
  <td id="projectalign">
   <div id="projectname">AngelScript
   </div>
  </td>
    <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <span id="MSearchSelect"                onmouseover="return searchBox.OnSearchSelectShow()"                onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
          <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__api__memory__functions.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">Memory functions</div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga527ab125defc58aa40cc151a25582a31"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__memory__functions.html#ga527ab125defc58aa40cc151a25582a31">asSetGlobalMemoryFunctions</a> (<a class="el" href="angelscript_8h.html#abfe11f5787462216b1682a5d3f5486be">asALLOCFUNC_t</a> allocFunc, <a class="el" href="angelscript_8h.html#adeecc934971e695fc4441a47694860fb">asFREEFUNC_t</a> freeFunc)</td></tr>
<tr class="memdesc:ga527ab125defc58aa40cc151a25582a31"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the memory management functions that AngelScript should use.  <br /></td></tr>
<tr class="separator:ga527ab125defc58aa40cc151a25582a31"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9267c4ad35aceaf7cc0961cd42147ee7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__memory__functions.html#ga9267c4ad35aceaf7cc0961cd42147ee7">asResetGlobalMemoryFunctions</a> ()</td></tr>
<tr class="memdesc:ga9267c4ad35aceaf7cc0961cd42147ee7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove previously registered memory management functions.  <br /></td></tr>
<tr class="separator:ga9267c4ad35aceaf7cc0961cd42147ee7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8d26e33db9ce5a9dd61cf7ee2fe3cd23"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__memory__functions.html#ga8d26e33db9ce5a9dd61cf7ee2fe3cd23">asAllocMem</a> (size_t size)</td></tr>
<tr class="memdesc:ga8d26e33db9ce5a9dd61cf7ee2fe3cd23"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate memory using the memory function registered with AngelScript.  <br /></td></tr>
<tr class="separator:ga8d26e33db9ce5a9dd61cf7ee2fe3cd23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9da61275bbfd5f7bd55ed411d05fe103"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__memory__functions.html#ga9da61275bbfd5f7bd55ed411d05fe103">asFreeMem</a> (void *mem)</td></tr>
<tr class="memdesc:ga9da61275bbfd5f7bd55ed411d05fe103"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deallocates memory using the memory function registered with AngelScript.  <br /></td></tr>
<tr class="separator:ga9da61275bbfd5f7bd55ed411d05fe103"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga8d26e33db9ce5a9dd61cf7ee2fe3cd23" name="ga8d26e33db9ce5a9dd61cf7ee2fe3cd23"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8d26e33db9ce5a9dd61cf7ee2fe3cd23">&#9670;&#160;</a></span>asAllocMem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> void * asAllocMem </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>The size of the buffer to allocate </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the allocated buffer, or null on error. </dd></dl>

</div>
</div>
<a id="ga9da61275bbfd5f7bd55ed411d05fe103" name="ga9da61275bbfd5f7bd55ed411d05fe103"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9da61275bbfd5f7bd55ed411d05fe103">&#9670;&#160;</a></span>asFreeMem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> void asFreeMem </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>mem</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">mem</td><td>A pointer to the buffer to deallocate </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga9267c4ad35aceaf7cc0961cd42147ee7" name="ga9267c4ad35aceaf7cc0961cd42147ee7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9267c4ad35aceaf7cc0961cd42147ee7">&#9670;&#160;</a></span>asResetGlobalMemoryFunctions()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> int asResetGlobalMemoryFunctions </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>A negative value on error.</dd></dl>
<p>Call this method to restore the default memory management functions. </p>

</div>
</div>
<a id="ga527ab125defc58aa40cc151a25582a31" name="ga527ab125defc58aa40cc151a25582a31"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga527ab125defc58aa40cc151a25582a31">&#9670;&#160;</a></span>asSetGlobalMemoryFunctions()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> int asSetGlobalMemoryFunctions </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="angelscript_8h.html#abfe11f5787462216b1682a5d3f5486be">asALLOCFUNC_t</a>&#160;</td>
          <td class="paramname"><em>allocFunc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="angelscript_8h.html#adeecc934971e695fc4441a47694860fb">asFREEFUNC_t</a>&#160;</td>
          <td class="paramname"><em>freeFunc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">allocFunc</td><td>The function that will be used to allocate memory. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">freeFunc</td><td>The function that will be used to free the memory. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A negative value on error.</dd></dl>
<p>Call this method to register the global memory allocation and deallocation functions that AngelScript should use for memory management. This function should be called before <a class="el" href="group__api__principal__functions.html#ga030e559c6ec9e2ee0be5836b84061bac">asCreateScriptEngine</a>.</p>
<p>If not called, AngelScript will use the malloc and free functions from the standard C library. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Sun May 21 2023 10:12:40 for AngelScript by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
  </ul>
</div>
</body>
</html>
